﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Easy.BLL;
using Easy.Operation;
using Easy.Operation.Expression;

namespace Easy.Web.Pages.DataPages
{
    public partial class top : BasePage
    {
        private string _logo;
        private string _title;
        private string _appphoto;
        public string logo { get { return _logo; } }
        public string title { get { return _title; } }
        public string appphoto { get { return _appphoto; } }
        protected void Page_Load(object sender, EventArgs e)
        {
            DataService ser = new DataService("Parameter", new Guid(ConfigurationManager.AppSettings["AdminUserId"].ToString()));
            FilterExpression filter = new FilterExpression();
            filter.FilterOperator = LogicalOperator.AND;
            List<ConditionExpression> Condition = new List<ConditionExpression>();
            Condition.Add(new ConditionExpression() { AttributeName = "DeletionStateCode", Values = new List<object> { "0" }, Operator = ConditionOperator.Equal });
            Condition.Add(new ConditionExpression() { AttributeName = "Name", Values = new List<object> { "title", "app", "logo" }, Operator = ConditionOperator.In });
            filter.Conditions = Condition;
            Dictionary<string, object> tp = ser.RetrieveMultiple_List(new string[] { "Name", "Value" }, filter, "", 0, 50);
            if ((int)tp["Total"] > 0)
            {
                List<Dictionary<string, object>> ja = (List<Dictionary<string, object>>)tp["List"];
                for (int i = 0; i < ja.Count; i++)
                {
                    if (ja[i]["name"].ToString() == "logo")
                    {
                        if (ja[i]["name"].ToString() == "logo" && ja[i]["value"].ToString() != String.Empty)
                        {
                            this._logo = ja[i]["value"].ToString();
                        }
                    }
                    if (ja[i]["name"].ToString() == "title")
                    {
                        if (ja[i]["name"].ToString() == "title" && ja[i]["value"].ToString() != String.Empty)
                        {
                            this._title = ja[i]["value"].ToString();
                        }

                    }
                    if (ja[i]["name"].ToString() == "app")
                    {
                        if (ja[i]["name"].ToString() == "app" && ja[i]["value"].ToString() != String.Empty)
                        {
                            this._appphoto = ja[i]["value"].ToString();
                        }
                    }
                }

            }
            else
            {
                this._logo = "";
                this._title = "";
                this._appphoto = "";
            }
        }
    }
}